<?php

namespace frontend\controllers;

use bc\controller\FrontController;
use bc\model\wx\DownloadModel;

class VoiceController extends FrontController
{
	
	public function actionIndex()
	{
		//生成js sdk签名
		$jsConfig = $this->configJsApi();
		
		$view['js_config'] = $jsConfig;
		return $this->render('index', $view);
	}
	
	
	/**
	 * 下载多媒体文件
	 */
	public function actionSave()
	{
		$msg = [];
		$msg['error'] = 1;
		if($this->getRequest()->isAjax == true)
		{
			$media_id = $this->post('media_id');
			$model = new DownloadModel();
			$data['media_id'] = $media_id;
			$data['type_id'] = '2';
			$data['create_time'] = time();
			$model->add($data);
			$msg['error'] = 0;
		}
		echo json_encode($msg);
		exit;
		
	}
}

